package demo12;

public class Test {
    public static void main(String[] args)  throws {

    }
    public static int countSegments(String s){
        int len =s.length();
        if(len==0){
            return 0;
        }
        int count =0;
        String[] ss=s.split(" ");
        for(String r:ss){
            if(r.length()!=0){
                count++;
            }
        }
        return count;
    }
    public static void main2(String[] args) {
        int count =countSegments("!!!!!   a,fasfa");
        System.out.println(count);
    }
    public String toLowerCase(String s){
        StringBuilder stringBuilder =new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            char ch =s.charAt(i);
            //判断当前字符，是不是字母
            if(Character.isLetter(ch)){
                //判断当前是不是大写字母
                if(Character.isUpperCase(ch)){
                    ch =(char)(ch+32);
                }
            }
            stringBuilder.append(ch);
        }
        return stringBuilder.toString();
    }
    String str =new String("good");
    char [] ch ={'a','p','p','e'};

    public static void main1(String[] args) {
        Test ex = new Test();
        ex.change(ex.str,ex.ch);
        System.out.println(ex.str+" and" );
        System.out.println(ex.ch);
    }

    private void change(String str, char[] ch) {
        str ="test ok";
        ch[0] ='g';
    }
    public static void func1(int[] array){
        array =new int[10];
    }
    public static void func2(int[] array){
        array[0] =10;
    }
}
